from IPython.display import HTML
HTML('''<script>
code_show=true;
function code_toggle() {
if (code_show){
$('div.input').hide();
} else {
$('div.input').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Click here to toggle on/off the raw code."></form>''')
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import matplotlib as mpl
import datetime
import math
import scipy as sc
from scipy import stats
from datetime import datetime
from datetime import timedelta
from IPython.display import Image
import pylab
import matplotlib.cm as cm
import json
#to make interactive figures
from ipywidgets import interact
from bokeh.plotting import figure, show, output_notebook
from bokeh.models.widgets import Panel, Tabs
#from bokeh.io import output_file, show
output_notebook()
import sys
sys.path.insert(0, "/Users/jennavergeynst/Applications/TeX/")
sys.path.insert(0, "/Users/jennavergeynst/Documents/AllroundFunctions/")
from plotFunctions import HPEmCompare
refTags = list(['R1','R2','R3'])
syncTags = list(['S7','S8','S10','S12','S13','S14','S15','S16','S17','S18'])
# S18' and S9 are stations without synctags.
IDlist = refTags + syncTags
# load positioning data of reference and synctags
dataRefSync = {}
for tagID in IDlist:
filename = '~/Documents/DataHam/VPS/VPS-INBO-01-Results20160304/Positions/TRANSMITTER-'+tagID+'-CALC-POSITIONS.csv'
temp = pd.read_csv(filename)
temp['DATETIME'] = pd.to_datetime(temp['DATETIME'])
dataRefSync[tagID] = temp
dataRefSync_kols = pd.concat(dataRefSync, axis=0)
dataRefSync = pd.concat(dataRefSync, axis = 1)
In this section, I calculated some statistics (mean, median, standard deviation, quartiles) for the 3 reference tags and 10 sync tags, for both HPE and HPEm.
dataRefSync.loc[:, (slice(None), 'HPE')].describe()
dataRefSync.loc[:, (slice(None), 'HPEm')].describe()
Some transmitter stations have a very high mean HPEm (and 3rd quartile), for instance S12, S15, S7. Might be related to their location close to a wall...
Below you see the study site and the receiver lay-out. Positioning occurs only upstream of the sluice complex. The complex contains 3 sluice locks. At the left bank, upstream of the most southern sluice lock, you can see a side channel. This channel is used for pumping (at low flow) and turbining (at high flow), so the channel intake may also cause some noise and reflections (because it is another concrete construction).
Image("/Users/jennavergeynst/Documents/Analysis/QGis visualisaties/ReceiverArray.png")
Just an overview of stats for all HPEs and HPEms together.
dataRefSync_kols.loc[:,('HPE','HPEm')].describe()
Image("/Users/jennavergeynst/Documents/Analysis/QGis visualisaties/HPE_R1.png")
The figure above shows the positions calculated for reference tag 1. Color scale showing red to yellow for high to low HPE. My concern here is that some points with quite high HPEm (far from the actual R1-location), have a low HPE (yellow, so an apparently high position precision). Probably, these erroneous positions cannot be identified as 'bad positions' by HPE, because they might be caused by reflections on the wall or other disturbances. I think these high-HPEm points should be filtered out before constructing any relationship between HPEm and HPE. Do you agree?
Image("/Users/jennavergeynst/Documents/Analysis/QGis visualisaties/HPE_R2.png")
Same here, even worse HPEm-points still have low (yellow) HPE.
Image("/Users/jennavergeynst/Documents/Analysis/QGis visualisaties/HPE_R3.png")
Same here. Also, it shows quite a strange pattern of datapoints swarming around in different directions, for all positions which should locate the same reference tag. Maybe here the vicinity of the side channel intake (another concrete box) causes even more noise here. Allthough, for some sync transmitters located further from this side channel intake, the pattern is similar...
In the graph below, you can see the HPEm evolution in time for all ref and sync transmitters. Some really high peaks occur for which I would think they should be filtered out first...
ylim = 140
tab=[0]*len(IDlist)
i=0
for tag in IDlist:
p = figure(title='Evolution in time for HPEm '+tag,plot_height=400, plot_width=950,
y_axis_label='HPEm [m]', x_axis_type="datetime", y_range =(-5,ylim))
p.line(dataRefSync[tag]['DATETIME'], dataRefSync[tag]['HPEm'])
tab[i] = Panel(child=p, title=tag)
i=i+1
tabs = Tabs(tabs=tab)
show(tabs)